package Concurent;

import java.util.concurrent.CountDownLatch;

/**
 * Created by root on 17-6-9.
 */


public abstract class  AtomicDemo1{
    public static int x = 0;

    public static void main(String[] args) {
        CountDownLatch cdl = new CountDownLatch(2);
        new Thread(new T21(cdl)).start();
        try {
            cdl.await();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(x);
    }
}

class T21 implements Runnable{
    private CountDownLatch cdl = null;
    public T21(CountDownLatch cdl) {
        this.cdl = cdl;
    }

    @Override
    public void run() {
        for (int i =0;i<1000;i++){
            AtomicDemo1.x += 1;
        }
    }
}

